package ch6.ex2;

import static ch6.print.Print.*;

class Cleanser{
	private String s = "Cleanser";
	
	public void append(String a){
		s += a;
	}
	public void dulite(){
		append(" dulite()");
	}
	public void apply(){
		append(" apply()");
	}
	public void scrub(){
		append(" scrub()");
	}
	public String toString(){
		return s;
	}
	
	public static void main(String... args){
		Cleanser c = new Cleanser();
		c.dulite();
		c.apply();
		c.scrub();
		println(c);
	}
}
public class Detergent extends Cleanser{
	
	public void scrub(){
		append(" Detergent.scrub()");
		super.scrub();
	}
	
	public void foam(){
		append(" foam()");
	}
	
	public static void main(String... args){
		Detergent d = new Detergent();
		d.dulite();
		d.apply();
		d.scrub();
		d.foam();
		println(d);
		println("Testing base class:");
		Cleanser.main(args);
	}
}
